package com.lowca.news.security;


import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.security.core.Authentication;
import org.springframework.security.web.authentication.logout.SimpleUrlLogoutSuccessHandler;
import org.springframework.security.web.authentication.rememberme.TokenBasedRememberMeServices;

public class MyUrlLogoutSuccessHandler extends SimpleUrlLogoutSuccessHandler {

	private TokenBasedRememberMeServices tokenBasedRememberMeServices;

	@Override
	public void onLogoutSuccess(HttpServletRequest request,
			HttpServletResponse response, Authentication authentication)
			throws IOException, ServletException {
		tokenBasedRememberMeServices.logout(request, response, authentication);
		super.onLogoutSuccess(request, response, authentication);
	}

	public TokenBasedRememberMeServices getTokenBasedRememberMeServices() {
		return tokenBasedRememberMeServices;
	}

	public void setTokenBasedRememberMeServices(
			TokenBasedRememberMeServices tokenBasedRememberMeServices) {
		this.tokenBasedRememberMeServices = tokenBasedRememberMeServices;
	}

}